﻿/*----------------------------------------------------------------
//  <copyright file="OracleEntityFrameworkCorePack.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2022-11-15 13:58</last-date>
//----------------------------------------------------------------*/



namespace MicroCloud.Entity.Oracle
{
    #region "Oracle实体框架核心模块(OracleEntityFrameworkCore)"
    /// <summary>
    /// Oracle实体框架核心模块(OracleEntityFrameworkCore)
    /// </summary>
    [Description("Oracle实体框架核心模块(OracleEFCore)")]
    public class OracleEntityFrameworkCorePack : EntityFrameworkCorePackBase
    {
        #region "属性"
        #region "获取 模块级别"
        /// <summary>
        /// 获取 模块级别，级别越小越先启动
        /// </summary>
        public override PackLevel Level => PackLevel.Framework;
        #endregion
        #region "获取 模块启动顺序编号"
        /// <summary>
        /// 获取 模块启动顺序编号，模块启动的顺序先按级别启动，同一级别内部再按此顺序启动，
        /// 级别默认为0，表示无依赖，需要在同级别有依赖顺序的时候，再重写为>0的顺序值
        /// </summary>
        public override int OrderNo => 1;
        #endregion
        #region "获取 数据库类型"
        /// <summary>
        /// 获取 数据库类型
        /// </summary>
        protected override DatabaseType DatabaseType => DatabaseType.Oracle;
        #endregion

        #endregion

        #region "方法"
        #region "将模块服务添加到依赖注入服务容器中"
        /// <summary>
        /// 将模块服务添加到依赖注入服务容器中
        /// </summary>
        /// <param name="services">依赖注入服务容器</param>
        /// <returns></returns>
        public override IServiceCollection AddServices(IServiceCollection services)
        {
            services = base.AddServices(services);

            services.AddSingleton<ISequentialGuidGenerator, OracleSequentialGuidGenerator>();
            services.AddScoped(typeof(ISqlExecutor<,>), typeof(OracleDapperSqlExecutor<,>));
            services.AddSingleton<IDbContextOptionsBuilderDriveHandler, OracleDbContextOptionsBuilderDriveHandler>();

            return services;
        }
        #endregion

        #endregion

    }
    #endregion

}
